package com.thekernel.youdaoyun.mapper;

import com.thekernel.youdaoyun.bean.SysLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Component;

/**
 * @Author TheKernel
 * @Date 2019/10/15 5:59 下午
 * @Version 1.0
 * @Description
 */
@Component
@Mapper
public interface SysLogMapper {

    /**
     * 保存 操作日志
     * @param sysLog 操作日志
     * @return 0: 添加失败 1: 添加成功
     */
    @Insert("INSERT INTO `sys_log`(`username`, `operation`, `time`, `method`, `params`, `ip`, `create_time`)" +
            " VALUES(#{username}, #{operation}, #{time}, #{method}, #{params}, #{ip}, #{createTime})")
    @Options(useGeneratedKeys = true, keyProperty = "logId")
    int saveSysLog(SysLog sysLog);

}
